
using System;
using System.Collections;
using System.Web.UI.WebControls;

using Awaken.Framework;
using Nullables;

namespace Northwind.Domain.Entities
{
    public partial class Region : IEntity
    {
        protected static RegionBroker broker;
        public static RegionBroker Broker
        {
            get
            {
                if (broker == null)
                {
                    broker = new RegionBroker();
                }
                return broker;
            }
        }

        #region IEntity Members

        public string EntityID
        {
            get { return string.Empty; }
        }
        
        public string EntityName
        {
            get { return string.Empty; }
        }

        public void Save()
        {
            Broker.Save(this);
        }
        
        public void Delete()
        {
            Broker.Delete(this);
        }
        
        #endregion
    
        #region Constructor
        
        public Region()
        {
            // Default, no arg constructor.
        }
        
        #endregion
            
        #region Public Properties / Protected Fields
                        
        
        protected System.Int32? _RegionID;
        public System.Int32? RegionID
        {
            get{ return _RegionID; }
            set{ _RegionID=value; }
        }
        
        protected string _RegionDescription;
        public string RegionDescription
        {
            get{ return _RegionDescription; }
            set{ _RegionDescription=value; }
        }
        
        
        
        // One-To-Many: Territories.RegionID  
        protected IList _TerritoryList;
        public IList TerritoryList
        {
            get{ return _TerritoryList; }
            set{ _TerritoryList=value; }
        }
        
        
                
        
        
        
        #endregion
    }
    
    #region RegionBroker

    public partial class RegionBroker : IBroker
    {
        #region IBroker Members

        public Type EntityType
        {
            get { return typeof(Region); }
        }
        
        public Region GetByID(object id)
        {
            return (Region)Awaken.Framework.Gateway.GetByID(EntityType, id);
        }

        public IList GetAll()
        {
            return Awaken.Framework.Gateway.GetAll(EntityType);
        }

        public void Save(IEntity entity)
        {
            Awaken.Framework.Gateway.Save(entity);
        }
        
        public void Delete(IEntity entity)
        {
            Awaken.Framework.Gateway.Delete(entity);
        }
        
        #endregion
    }
    #endregion
}
